<extend name="$_admin_public_layout"/>

<block name="style">
    <include file="./Application/Common/util/lyf/builder/style.html" />
</block>

<block name="script">
    <script type="text/javascript">
        $(function(){
            $('.auth input[type="checkbox"]').on('change',function(){
                //遍历选中当前权限的子权限
                $('.'+$(this).attr('data-module-name')+' .auth'+$(this).val()).find('input').prop('checked',this.checked);

                //遍历选中当前权限的父权限
                if ($(this).is(':checked') == true) {
                    var $fix = $(this);
                    while ($fix.length > 0) {
                        var $tmp = $fix.closest('div').prev('label').find('input');
                        console.log($tmp);
                        if ($tmp.length > 0) {
                            $tmp.attr("checked",true);
                            $fix = $tmp;
                        } else {
                            break;
                        }
                    }
                }
            });
        });
    </script>
</block>

<block name="main">
    <script type="text/javascript" src="__ROOT__/PUBLIC/Ueditor/ueditor.config.js"></script>
    <script type="text/javascript" src="__ROOT__/PUBLIC/Ueditor/ueditor.all.min.js"></script>
    <script type="text/javascript" src="__ROOT__/PUBLIC/ueditor/lang/zh-cn/zh-cn.js"></script>
    <script type="text/javascript">
      UE.getEditor('intro_detail',{  //intro_detail为要编辑的textarea的id
        initialFrameWidth: 1000,  //初始化宽度
        initialFrameHeight: 500,  //初始化高度
      });
     
    </script>
        <div class="panel-body">
            <form action="{:url('')}" method="post" class="form form-builder">
                <ul class="nav-tabs nav">
                    <li class="active"><a href="#tab1" data-toggle="tab">产品信息</a></li>
                    <!-- <li class="img"><a href="#tab2" data-toggle="tab">图片管理</a></li> -->
                    <li class="text"><a href="#tab3" data-toggle="tab">描述</a></li>
                    <!-- <neq name="info.id" value="1"><li><a href="#tab2" data-toggle="tab">图片管理</a></li></neq> -->
                </ul>
                <div class="tab-content">
                    <div id="tab1" class="tab-pane active">
                        <div class="form-group"></div>
                        <neq name="info.id" value="1">
                            <div class="form-group">
                                <label class="left control-label">所属分类：</label>
                                <div class="right">
                                    <select name="group" class="form-control select lyui-select">
                                        <volist name="all_group" id="group">
                                            <option value="{$group}"
                                                <php>if($key == $info['pid']) echo 'selected="selected"';</php> >
                                                {$group}
                                            </option>
                                        </volist>
                                    </select>
                                </div>
                            </div>
                        <else />
                            <!-- <div class="alert alert-success">{$info.title}拥有后台所有权限</div> -->
                        </neq>
                        <div class="form-group">
                            <label class="left control-label">信息标题：</label>
                            <div class="right">
                                <input type="text" class="form-control input" name="title" value="{$info.title|default=''}">
                            </div>
                        </div>
                        
                    </div>
                    <neq name="info.id" value="1">
                        
                        <div id="tab3" class="tab-pane">
                            <!-- <h1>百度编辑器</h1> -->
                            <textarea name="main" id="intro_detail" style="height: 500px;">{$info.main}</textarea>
                        </div>
                        <div class="form-group"></div>
                        </div>
                    </neq>
                </div>
                <div class="form-group"></div>
                <div class="form-group">
                    <input type="hidden" name="id" value="{$info.id|default=''}">
                    <button style="width: 120px;" class="btn btn-primary submit ajax-post" type="submit" target-form="form">确定</button>
                    <button style="width: 120px;" class="btn btn-danger return" onclick="javascript:history.back(-1);return false;">取消</button>
                </div>
            </form>
        </div>
    </div>
</block>
